A workload monitor needs the ability to interrupt and modify a query in progress. Some examples of query modification include canceling the query, suspending the query, changing a query's priority, and reconfiguring the use of virtual memory.
In an operating system that supports multi-threading, one thread can be blocking in a database management system library call to execute the query. At the same time, another thread may monitor connections from clients for new messages, such as requests to interrupt the query. To process this kind of message, the receiving thread can use memory shared with the executing thread to communicate the specific type of interruption requested, for example, to cancel the query.
In an operating system that supports signaling, a monitor process may send a signal to the database management system library executing the query. The database management system library may temporarily install a special signal handler while the query to be modified is executing. This signal handler may terminate the database management system library's wait for the completion of the query.
Alternatively, the signal handler may set a flag that can be accessed by the database management system library. A specially configured database management system library can then use regularly scheduled timeouts to check the flag. However, some operating systems do not fully support signals with all types of processes.
Unfortunately, the signal does not contain information about what modification to perform to the query. As such, the signal handler may not be flexible enough to modify queries without additional transactions to determine the type of modification being requested.
In a message-based, massively parallel operating system, a database connectivity server may execute the query using a call to a database management system library application program interface. The call to the library application program interface may not return until results of the query are available.
During the time the call is blocked, most of the query processing is performed by database management system server processes. While the server processes are working, the library may be stuck in an I/O wait loop. It is not uncommon for several minutes to elapse before results of a query are available and the library call unblocks.
In this environment, the modification of an executing query may be challenging. The database connectivity server remains blocked in the library and may not respond to a message received from the workload monitor, even if the workload monitor is a client of the database connectivity server. The library also may not take messages from any of the database connectivity server's clients, because the client connections are owned by the database connectivity server.